package com.thinkgem.jeesite.modules.lottery.entity;

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.Callable;
import org.web3j.abi.TypeReference;
import org.web3j.abi.datatypes.DynamicArray;
import org.web3j.abi.datatypes.Function;
import org.web3j.abi.datatypes.Type;
import org.web3j.abi.datatypes.Utf8String;
import org.web3j.crypto.Credentials;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.RemoteCall;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
import org.web3j.tx.gas.ContractGasProvider;

/**
 * <p>Auto generated code.
 * <p><strong>Do not modify!</strong>
 * <p>Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>,
 * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the 
 * <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
 *
 * <p>Generated with web3j version 4.3.0.
 */
public class Lottery extends Contract {
    private static final String BINARY = "0x60806040526000805534801561001457600080fd5b50611147806100246000396000f3fe60806040526004361061005c576000357c010000000000000000000000000000000000000000000000000000000090048063487daf02146100615780639d0be2731461009e578063bd229f45146100c7578063ea150e7314610104575b600080fd5b34801561006d57600080fd5b5061008860048036036100839190810190610d72565b61012d565b6040516100959190610f86565b60405180910390f35b3480156100aa57600080fd5b506100c560048036036100c09190810190610e76565b610281565b005b3480156100d357600080fd5b506100ee60048036036100e99190810190610e76565b610333565b6040516100fb9190610f86565b60405180910390f35b34801561011057600080fd5b5061012b60048036036101269190810190610db3565b6104f1565b005b60606001826040518082805190602001908083835b6020831015156101675780518252602082019150602081019050602083039250610142565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020805480602002602001604051908101604052809291908181526020016000905b82821015610276578382906000526020600020018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102625780601f1061023757610100808354040283529160200191610262565b820191906000526020600020905b81548152906001019060200180831161024557829003601f168201915b5050505050815260200190600101906101ba565b505050509050919050565b60006001836040518082805190602001908083835b6020831015156102bb5780518252602082019150602081019050602083039250610296565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902090508082908060018154018082558091505090600182039060005260206000200160009091929091909150908051906020019061032c929190610920565b5050505050565b60606002836040518082805190602001908083835b60208310151561036d5780518252602082019150602081019050602083039250610348565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020826040518082805190602001908083835b6020831015156103d657805182526020820191506020810190506020830392506103b1565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020805480602002602001604051908101604052809291908181526020016000905b828210156104e5578382906000526020600020018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104d15780601f106104a6576101008083540402835291602001916104d1565b820191906000526020600020905b8154815290600101906020018083116104b457829003601f168201915b505050505081526020019060010190610429565b50505050905092915050565b60006001856040518082805190602001908083835b60208310151561052b5780518252602082019150602081019050602083039250610506565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390209050600080905060006002876040518082805190602001908083835b60208310151561059f578051825260208201915060208101905060208303925061057a565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390208660008151811015156105e157fe5b906020019060200201516040518082805190602001908083835b60208310151561062057805182526020820191506020810190506020830392506105fb565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020905060008090505b8651811015610916576002886040518082805190602001908083835b60208310151561069c5780518252602082019150602081019050602083039250610677565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902087828151811015156106dd57fe5b906020019060200201516040518082805190602001908083835b60208310151561071c57805182526020820191506020810190506020830392506106f7565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020915060006002896040518082805190602001908083835b60208310151561078b5780518252602082019150602081019050602083039250610766565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020905060008090505b87838151811015156107d457fe5b9060200190602002015160ff1681101561087657838688878060010198508151811015156107fe57fe5b9060200190602002015160ff1681548110151561081757fe5b9060005260206000200190806001815401808255809150509060018203906000526020600020016000909192909190915090805460018160011615610100020316600290046108679291906109a0565b505080806001019150506107c6565b508281898481518110151561088757fe5b906020019060200201516040518082805190602001908083835b6020831015156108c657805182526020820191506020810190506020830392506108a1565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020908054610907929190610a27565b5050808060010191505061065b565b5050505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061096157805160ff191683800117855561098f565b8280016001018555821561098f579182015b8281111561098e578251825591602001919060010190610973565b5b50905061099c9190610a97565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106109d95780548555610a16565b82800160010185558215610a1657600052602060002091601f016020900482015b82811115610a155782548255916001019190600101906109fa565b5b509050610a239190610a97565b5090565b828054828255906000526020600020908101928215610a865760005260206000209182015b82811115610a855782829080546001816001161561010002031660029004610a75929190610abc565b5091600101919060010190610a4c565b5b509050610a939190610b43565b5090565b610ab991905b80821115610ab5576000816000905550600101610a9d565b5090565b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610af55780548555610b32565b82800160010185558215610b3257600052602060002091601f016020900482015b82811115610b31578254825591600101919060010190610b16565b5b509050610b3f9190610a97565b5090565b610b6c91905b80821115610b685760008181610b5f9190610b6f565b50600101610b49565b5090565b90565b50805460018160011615610100020316600290046000825580601f10610b955750610bb4565b601f016020900490600052602060002090810190610bb39190610a97565b5b50565b600082601f8301121515610bca57600080fd5b8135610bdd610bd882610fd5565b610fa8565b9150818183526020840193506020810190508360005b83811015610c235781358601610c098882610cb2565b845260208401935060208301925050600181019050610bf3565b5050505092915050565b600082601f8301121515610c4057600080fd5b8135610c53610c4e82610ffd565b610fa8565b91508181835260208401935060208101905083856020840282011115610c7857600080fd5b60005b83811015610ca85781610c8e8882610d5e565b845260208401935060208301925050600181019050610c7b565b5050505092915050565b600082601f8301121515610cc557600080fd5b8135610cd8610cd382611025565b610fa8565b91508082526020830160208301858383011115610cf457600080fd5b610cff8382846110ba565b50505092915050565b600082601f8301121515610d1b57600080fd5b8135610d2e610d2982611051565b610fa8565b91508082526020830160208301858383011115610d4a57600080fd5b610d558382846110ba565b50505092915050565b6000610d6a82356110ad565b905092915050565b600060208284031215610d8457600080fd5b600082013567ffffffffffffffff811115610d9e57600080fd5b610daa84828501610d08565b91505092915050565b60008060008060808587031215610dc957600080fd5b600085013567ffffffffffffffff811115610de357600080fd5b610def87828801610d08565b945050602085013567ffffffffffffffff811115610e0c57600080fd5b610e1887828801610bb7565b935050604085013567ffffffffffffffff811115610e3557600080fd5b610e4187828801610c2d565b925050606085013567ffffffffffffffff811115610e5e57600080fd5b610e6a87828801610c2d565b91505092959194509250565b60008060408385031215610e8957600080fd5b600083013567ffffffffffffffff811115610ea357600080fd5b610eaf85828601610d08565b925050602083013567ffffffffffffffff811115610ecc57600080fd5b610ed885828601610d08565b9150509250929050565b6000610eed8261108a565b80845260208401935083602082028501610f068561107d565b60005b84811015610f3f578383038852610f21838351610f50565b9250610f2c826110a0565b9150602088019750600181019050610f09565b508196508694505050505092915050565b6000610f5b82611095565b808452610f6f8160208601602086016110c9565b610f78816110fc565b602085010191505092915050565b60006020820190508181036000830152610fa08184610ee2565b905092915050565b6000604051905081810181811067ffffffffffffffff82111715610fcb57600080fd5b8060405250919050565b600067ffffffffffffffff821115610fec57600080fd5b602082029050602081019050919050565b600067ffffffffffffffff82111561101457600080fd5b602082029050602081019050919050565b600067ffffffffffffffff82111561103c57600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff82111561106857600080fd5b601f19601f8301169050602081019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b838110156110e75780820151818401526020810190506110cc565b838111156110f6576000848401525b50505050565b6000601f19601f830116905091905056fea265627a7a72305820504287b6a14171d57cd9c9c439eba297066a428bc964c8180215d33eedf4a5e16c6578706572696d656e74616cf50037";

    public static final String FUNC_PARTICIPATE = "participate";

    public static final String FUNC_RUN = "run";

    public static final String FUNC_GETWINNERS = "getWinners";

    public static final String FUNC_GETLIST = "getList";

    protected static final HashMap<String, String> _addresses;

    static {
        _addresses = new HashMap<String, String>();
        _addresses.put("5777", "0xbE909Edd5CaC106B1bB13064DA7d31efc33DE8C3");
    }

    @Deprecated
    protected Lottery(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
    }

    protected Lottery(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
        super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
    }

    @Deprecated
    protected Lottery(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
    }

    protected Lottery(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
        super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
    }

    public RemoteCall<TransactionReceipt> participate(String activityid, String openid) {
        final Function function = new Function(
                FUNC_PARTICIPATE, 
                Arrays.<Type>asList(new org.web3j.abi.datatypes.Utf8String(activityid), 
                new org.web3j.abi.datatypes.Utf8String(openid)), 
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteCall<TransactionReceipt> run(String activityid, List<String> prizeid, List<BigInteger> quantity, List<BigInteger> winindex) {
        final Function function = new Function(
                FUNC_RUN, 
                Arrays.<Type>asList(new org.web3j.abi.datatypes.Utf8String(activityid), 
                new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.Utf8String>(
                        org.web3j.abi.datatypes.Utf8String.class,
                        org.web3j.abi.Utils.typeMap(prizeid, org.web3j.abi.datatypes.Utf8String.class)), 
                new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint8>(
                        org.web3j.abi.datatypes.generated.Uint8.class,
                        org.web3j.abi.Utils.typeMap(quantity, org.web3j.abi.datatypes.generated.Uint8.class)), 
                new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint8>(
                        org.web3j.abi.datatypes.generated.Uint8.class,
                        org.web3j.abi.Utils.typeMap(winindex, org.web3j.abi.datatypes.generated.Uint8.class))), 
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteCall<List> getWinners(String activityid, String prizeid) {
        final Function function = new Function(FUNC_GETWINNERS, 
                Arrays.<Type>asList(new org.web3j.abi.datatypes.Utf8String(activityid), 
                new org.web3j.abi.datatypes.Utf8String(prizeid)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Utf8String>>() {}));
        return new RemoteCall<List>(
                new Callable<List>() {
                    @Override
                    @SuppressWarnings("unchecked")
                    public List call() throws Exception {
                        List<Type> result = (List<Type>) executeCallSingleValueReturn(function, List.class);
                        return convertToNative(result);
                    }
                });
    }

    public RemoteCall<List> getList(String activityid) {
        final Function function = new Function(FUNC_GETLIST, 
                Arrays.<Type>asList(new org.web3j.abi.datatypes.Utf8String(activityid)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Utf8String>>() {}));
        return new RemoteCall<List>(
                new Callable<List>() {
                    @Override
                    @SuppressWarnings("unchecked")
                    public List call() throws Exception {
                        List<Type> result = (List<Type>) executeCallSingleValueReturn(function, List.class);
                        return convertToNative(result);
                    }
                });
    }

    @Deprecated
    public static Lottery load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        return new Lottery(contractAddress, web3j, credentials, gasPrice, gasLimit);
    }

    @Deprecated
    public static Lottery load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        return new Lottery(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
    }

    public static Lottery load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
        return new Lottery(contractAddress, web3j, credentials, contractGasProvider);
    }

    public static Lottery load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
        return new Lottery(contractAddress, web3j, transactionManager, contractGasProvider);
    }

    public static RemoteCall<Lottery> deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
        return deployRemoteCall(Lottery.class, web3j, credentials, contractGasProvider, BINARY, "");
    }

    @Deprecated
    public static RemoteCall<Lottery> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        return deployRemoteCall(Lottery.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
    }

    public static RemoteCall<Lottery> deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
        return deployRemoteCall(Lottery.class, web3j, transactionManager, contractGasProvider, BINARY, "");
    }

    @Deprecated
    public static RemoteCall<Lottery> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        return deployRemoteCall(Lottery.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
    }

    protected String getStaticDeployedAddress(String networkId) {
        return _addresses.get(networkId);
    }

    public static String getPreviouslyDeployedAddress(String networkId) {
        return _addresses.get(networkId);
    }
}
